﻿@using ThuySan.Models
@model IEnumerable<dynamic>
@{
    Html.Telerik().Grid(Model).Name("grid").Columns(c =>
                                                        {
                                                            c.Bound("Id").Title("#").Width(50);
                                                            c.Bound("ImageName").Title("").Width(100).ClientTemplate("<img width=\"80\" src=\"" + Html.UploadPath("Products") + "80x80_<#=ImageName#>\" title=\"<#=Description#>\"/>");
                                                            c.Bound("Description");
                                                            c.Bound("Priority");
                                                            c.Bound("IsBanner").ClientTemplate("<input <#= IsBanner #> class=\"check-box\" disabled=\"disabled\" type=\"checkbox\" />");
                                                            c.Template(v => v.Id).ClientTemplate("<a class=\"t-button t-button-icon t-grid-edit\" href=\"javascript:editImage(<#=Id#>);\"><span class=\"t-icon t-edit\"></span></a>" + "<a class=\"t-button t-button-icon t-grid-delete\" href=\"javascript:deleteImage(<#=Id#>);\"><span class=\"t-icon t-delete\"></span></a>").Width(80);
                                                        }).Sortable(c => c.Enabled(true)).DataKeys(c => c.Add("Id")).ToolBar(v => v.Custom().ButtonType(GridButtonType.Text).Text("Add New Image").HtmlAttributes(new {
                                                                                                                                                                                                                              href = "javascript:addImage();"
                                                                                                                                                                                                                      })).Pageable(c =>
                                                                                                                                                                                                                                       {
                                                                                                                                                                                                                                           c.Enabled(true);
                                                                                                                                                                                                                                           c.PageSize(25);
                                                                                                                                                                                                                                       }).DataBinding(c => c.Ajax().Select("GetProductImageList", "Product", new {
                                                                                                                                                                                                                                                                                                                         ViewBag.Id
                                                                                                                                                                                                                                                                                                                 })).Render();
}